package com.ejlchina.cashier;

import java.util.HashMap;
import java.util.Map;


/**
 * 返回结果
 * 
 * @author Troy.Zhou
 *
 */
public class Res {

	/**
	 * 结果代码：成功
	 */
	public static final String SUCCESS_CODE = "SUCCESS";
	
	/**
	 * 结果代码
	 */
	private String code;
	
	/**
	 * 结果描述信息
	 */
	private String message;

	/**
	 * 其他信息
	 */
	private Map<String, Object> extInfo = new HashMap<>();
	
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	/**
	 * 是否成功
	 * @return 是/否
	 */
	public boolean isSuccess() {
		return SUCCESS_CODE.equals(code);
	}

	public void putExtInfo(String key, Object value) {
		extInfo.put(key, value);
	}
	
	public Object getExtInfo(String key) {
		return extInfo.get(key);
	}
	
	@Override
	public String toString() {
		return "Res [code=" + code + ", message=" + message + "]";
	}
	
	
}
